﻿@model Jb.Web.ViewModels.PackageViewModel
@using Jb.Web.Utility;

@{
	String pageTitle = "Edit Package";
    if (Model != null && Model.ID == 0)
    {             
        pageTitle = "Add New Package";
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] = AdminMenu.ManagePackage; 
	bool _HasSaved = ViewData.HasSaved();    
}

<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>Enter necessary information and then click the Save button.</div>
</div>
<div class="jb-page-content">
@using (Html.BeginForm()) {
    @Html.ValidationSummary(false)

	if (Model == null)
    {
        @: @Html.WarningMessageBox("Sorry! Requested Package was not found for edit.")
    }
	else
	{
		if (_HasSaved) {
            @Html.SuccessMessageBox("Congratulations! The Package saved successfully")
        }
        else if (ViewData[AppConstants.ViewDataKeys.SAVED] != null && !_HasSaved)
        {
            @Html.WarningMessageBox("Sorry! we could not save the Package.")
        }
		@Html.HiddenFor(model => model.ID)

		<div class="editor-label">
			@Html.LabelFor(model => model.Name)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Name, new { @class="jb-long-text"})
			@Html.ValidationMessageFor(model => model.Name)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Price)
            <div class="jb-label-hint">If you want to make this a free package then simply make the price Zero (0)</div>
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Price)
			@Html.ValidationMessageFor(model => model.Price)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.CurrencyID)
		</div>
		<div class="editor-field">
			@Html.DropDownListFor(model => model.CurrencyID, BindSelectList.Currencies())
			@Html.ValidationMessageFor(model => model.CurrencyID)
		</div>
		<div class="editor-label">            
			@Html.LabelFor(model => model.MaxJobPost)
            <div class="jb-label-hint">
            This number determines, how many jobs can be posted by the subscribers of this package. 
            If you want to give <b>Unlimited</b> job posting opportunity then give the value as (-1). 
            </div>
		</div>
		<div class="editor-field">
			@Html.EditorFor(model => model.MaxJobPost)
			@Html.ValidationMessageFor(model => model.MaxJobPost)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.MaxResumeDownload)
            <div class="jb-label-hint">
            This number determines, how many resumes can be downloaded by the subscribers of this package. 
            If you want to give <b>Unlimited</b> resume download opportunity then give the value as (-1). 
            </div>
		</div>
		<div class="editor-field">
			@Html.EditorFor(model => model.MaxResumeDownload)
			@Html.ValidationMessageFor(model => model.MaxResumeDownload)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Duration)
            <div class="jb-label-hint">
            This is the valid duration of this package, give it in number of days. 
            If you want to give <b>Unlimited</b> duration then give the value as (-1). 
            </div>
		</div>
		<div class="editor-field">
			@Html.EditorFor(model => model.Duration)
			@Html.ValidationMessageFor(model => model.Duration)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.IsActive)
		</div>		
        <div class="editor-field  jb-inline-label">
		    @Html.RadioButtonFor(model => model.IsActive, "true", new { id = "rdnIsActive_1" }) <label for="rdnIsActive_1">Yes</label>
            @Html.RadioButtonFor(model => model.IsActive, "false", new { id = "rdnIsActive_0" }) <label for="rdnIsActive_0">No</label>
		    @Html.ValidationMessageFor(model => model.IsActive)
	    </div>
		@*<div class="editor-label">
			@Html.LabelFor(model => model.Created)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Created)
			@Html.ValidationMessageFor(model => model.Created)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Modified)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Modified)
			@Html.ValidationMessageFor(model => model.Modified)
		</div>*@
		<div class="jb-button-container">
			<button class="btn btn-primary" type="submit" data-loading-text="Saving..."><i class="icon-hdd icon-white"></i> Save</button> 
			@Html.AdminLink("Back to Package List", "List", "Package", new { @class = "btn" })
		</div>		
    }
}
</div>
@section JavaScriptPlaceHolder
{
@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)
}

